import time
from functools import wraps


def fac(n: int) -> int:
    res = 1
    while n > 0:
        res *= n
        n -= 1
    return res


def fac2(n: int) -> int:
    res = 1
    for i in range(1, n+1):
        res *= i
    return res


def main():
    for x in range(1000, 10000):
        start = time.time()
        res = fac(x)
        end = time.time()
        print("fac1 当n等于：{0} 结果：{1} 耗时：{2}".format(x, res, end - start))

        start = time.time()
        res = fac2(x)
        end = time.time()
        print("fac2 当n等于：{0} 结果：{1} 耗时：{2}".format(x, res, end - start))


if __name__ == '__main__':
    main()
